<?php

namespace app\model;

use support\Model;

class DeviceQualityInfo extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'quality_info';

    /**
     * The primary key associated with the table.
     *
     * @var string
     */
    protected $primaryKey = 'id';

    /**
     * Indicates if the model should be timestamped.
     *
     * @var bool
     */
    public $timestamps = true;


    public $fillable = [
        'device_id',
        'cl',
        'ph',
        'tds',
        'water',
        'filter',
        'status',
        'alarm',
        'auto',
        'created_at',
        'updated_at',
        'inlet_pressure',
        'inlet_flow',
        'inlet_tds',
        'outlet_pressure',
        'outlet_flow',
        'outlet_chlorine',
        'outlet_temp',
        'total_inlet',
        'total_outlet',
        'tank_level',
        'backwash_time',
        'backflush_time',
        'drain_time',
        'forward_flush_time',
        'water_production_drain_time',
        'filter_water_time',
        'concentrate_valve_opening',
        'tank_lower_limit',
        'tank_upper_limit',
        'manual_auto_status',
        'auto_status',
        'manual_status',
        'cellular_ip',
        'wifi_address',
        'wifi_name',
        'wired_ip_address',
        'leak_status',
        'tank_upper_alarm',
        'tank_lower_alarm',
        'tds_alarm',
        'outlet_temp_alarm',
        'outlet_rate_alarm_base',
        'outlet_rate_alarm_deviation',
    ];

    public function device()
    {
        return $this->belongsTo(Device::class, 'device_id', 'id');
    }
}